package com.example.nkj.circularseekbar;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

import com.gcssloop.widget.ArcSeekBar;
import io.feeeei.circleseekbar.CircleSeekBar;
import me.tankery.lib.circularseekbar.CircularSeekBar;


public class MainActivity extends AppCompatActivity {

    private ArcSeekBar mArcSeekBar1;
    private CircleSeekBar mCircleSeekBar1;
    private CircularSeekBar mCircularSeekBar1;
    private TextView View1 = null;
    private TextView View2 = null;
    private TextView View3 = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        View1 = (TextView) findViewById(R.id.textView);
        View2 = (TextView) findViewById(R.id.textView2);
        View3 = (TextView) findViewById(R.id.textView3);

        mArcSeekBar1 = (ArcSeekBar)findViewById(R.id.arc_seek_bar);
        mCircleSeekBar1 = (CircleSeekBar)findViewById(R.id.seekbar1);
        mCircularSeekBar1 = (CircularSeekBar)findViewById(R.id.seek_bar);
        mCircularSeekBar1.setMax(100);

        mArcSeekBar1.setOnProgressChangeListener(new ArcSeekBar.OnProgressChangeListener() {
            @Override
            public void onProgressChanged(ArcSeekBar seekBar, int progress, boolean isUser)
            {
                //final int i = seekBar.getProgress();
                //View1.setText(i+"%");
                View1.setText(progress+"%");
            }

            @Override
            public void onStartTrackingTouch(ArcSeekBar seekBar) {}

            @Override
            public void onStopTrackingTouch(ArcSeekBar seekBar) {}
        });

        mCircleSeekBar1.setOnSeekBarChangeListener(new CircleSeekBar.OnSeekBarChangeListener() {
            @Override
            public void onChanged(CircleSeekBar seekbar, int curValue)
            {
                View3.setText(curValue+"%");
            }
        });

        mCircularSeekBar1.setOnSeekBarChangeListener(new CircularSeekBar.OnCircularSeekBarChangeListener() {
            @Override
            public void onProgressChanged(CircularSeekBar circularSeekBar, float progress, boolean fromUser) {
                View2.setText(progress+"%");
            }

            @Override
            public void onStopTrackingTouch(CircularSeekBar seekBar) {
            }

            @Override
            public void onStartTrackingTouch(CircularSeekBar seekBar) {
            }
        });
    }
}
